package com.jl.smartcard.ui.preferences;

import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
import com.jl.smartcard.ui.ActivatorUI;
import static com.jl.smartcard.ui.preferences.SmartcardPrefConstants.*;

public class CardFileSystemPreferencePage extends FieldEditorPreferencePage
		implements IWorkbenchPreferencePage {

	public CardFileSystemPreferencePage() {
		super(GRID);
		setPreferenceStore(ActivatorUI.getDefault().getPreferenceStore());
		setDescription("Smart card file system setting");
	}

	@Override
	public void createFieldEditors() {
		// addField(new DirectoryFieldEditor(PreferenceConstants.P_PATH,
		// "&Directory preference:", getFieldEditorParent()));
		// addField(new BooleanFieldEditor(PreferenceConstants.P_BOOLEAN,
		// "&An example of a boolean preference", getFieldEditorParent()));
		RadioGroupFieldEditor fileIDRangeRadio = new RadioGroupFieldEditor(
				SmartcardPrefConstants.P_CHOICE_SEARCH_RANGE,
				"please select the file ID range",
				1,
				new String[][] { { "&default(parent ID - 0x1000 and parant ID - 0x2000)", P_CHOICE_SEARCH_RANGE_DEFAULT },
						{ "&all(0x0000~0xFFFF)", P_CHOICE_SEARCH_RANGE_ALL }, { "&input self", P_CHOICE_SEARCH_RANGE_INPUT } },
				getFieldEditorParent());
		addField(fileIDRangeRadio);
		final StringFieldEditor range = new StringFieldEditor(
				SmartcardPrefConstants.P_STRING_INPUT_RANGE,
				"Please input the range of file ID", getFieldEditorParent());
		//range.setEnabled(false, getFieldEditorParent());
		addField(range);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
	 */
	@Override
	public void init(IWorkbench workbench) {
	}

}
